<template>
  <div>
    <shopHeader></shopHeader>
    <div class="tab">
      <div class="tab-item">
        <!-- 使用replace的方式进行路由切换 （路由懒加载） -->
        <router-link to="/shop/goods" replace>点餐</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/shop/ratings" replace>评价</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/shop/info" replace>商家</router-link>
      </div>
    </div>
    <!-- 缓存路由组件对象 -->
    <keep-alive>
      <router-view />
    </keep-alive>
  </div>
</template>

<script>

import ShopHeader from '@/components/ShopHeader/ShopHeader'
export default {
  data () {
    return {}
  },
  mounted () {
    this.$store.dispatch('getShopInfo')
  },
  components: {
    shopHeader: ShopHeader
  }
}
</script>

<style lang="less" scoped>
.tab{
    height: 40px;
    line-height :40px;
    background: #fff;
    border-bottom: 1px solid rgba(7, 17, 27, 0.1);
    .tab-item{
      float: left;
      width: 33.33333%;
      text-align: center;
      font-size: 14px;
      color: rgb(77, 85, 93);
      a{
        display: block;
        position: relative;
        &.router-link-active{
          color: red;
          &::after{
            content: '';
            position :absolute;
            left :50%;
            bottom :1px;
            width :35px;
            height :2px;
            transform: translateX(-50%);
            background: red;
            }
        }
     }
  }
  }
</style>
